

from graphic1271 import *
import traceback




w, h = 400, 300     # 屏幕宽高
# ~ w, h = 200, 300     # 屏幕宽高
O = np.array([0., 0.35, -1.])   # 摄像机位置
Q = np.array([0., 0., 0.])      # 摄像机指向
img = np.zeros((h, w, 3))
r = float(w) / h
S = (-1., -1. / r + .25, 1., 1. / r + .25)

for i, x in enumerate(np.linspace(S[0], S[2], w)):
    print("%.2f" % (i / float(w) * 100), "%")
    for j, y in enumerate(np.linspace(S[1], S[3], h)):
        Q[:2] = (x, y)
        draw_dot(i, h - j - 1, c255(intersect_color(O, normalize(Q - O), 1)))

    win1271.blit(memory)



win1271.blit(memory)

while True:
    s = input()
    if s:
        with open("commands.py") as fo:
            code = fo.read()
            try:
                exec(code)
            except :
                traceback.print_exc()
    else:
        break



